package com.icetech.eom;

import org.mybatis.spring.annotation.MapperScan;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.servlet.MultipartConfigFactory;
import org.springframework.boot.web.servlet.ServletComponentScan;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ImportResource;
import org.springframework.scheduling.annotation.EnableAsync;
import springfox.documentation.swagger2.annotations.EnableSwagger2;

import javax.servlet.MultipartConfigElement;

@SpringBootApplication
@ServletComponentScan
@MapperScan("com.icetech.eom.dao")
@EnableSwagger2
@EnableAsync
@ImportResource({"classpath:dubbo-*.xml"})
public class EOMApplication {
	private static final Logger logger = LoggerFactory.getLogger(EOMApplication.class);
	public static void main(String[] args) {
        SpringApplication.run(EOMApplication.class, args);
		logger.info("------启动完成------");
	}
	@Value("${eom.file.path}")
	private String filePath;
	@Bean
	MultipartConfigElement multipartConfigElement() {
		MultipartConfigFactory factory = new MultipartConfigFactory();
		//临时存放文件
		factory.setLocation(filePath);
		return factory.createMultipartConfig();
	}
}
